ClassCalendarController = function () {
    function _initCalendarPage() {
        var today = new Date(),
            events = [
                +new Date(today.getFullYear(), today.getMonth(), 8),
                +new Date(today.getFullYear(), today.getMonth(), 12),
                +new Date(today.getFullYear(), today.getMonth(), 24),
                +new Date(today.getFullYear(), today.getMonth() + 1, 6),
                +new Date(today.getFullYear(), today.getMonth() + 1, 7),
                +new Date(today.getFullYear(), today.getMonth() + 1, 25),
                +new Date(today.getFullYear(), today.getMonth() + 1, 27),
                +new Date(today.getFullYear(), today.getMonth() - 1, 3),
                +new Date(today.getFullYear(), today.getMonth() - 1, 5),
                +new Date(today.getFullYear(), today.getMonth() - 2, 22),
                +new Date(today.getFullYear(), today.getMonth() - 2, 27)
            ];
        $('#calendar_min_calendar_div').kendoCalendar({
            value: today,
            dates: events,
            month: {
                // template for dates in month view
                content: '# if ($.inArray(+data.date, data.dates) != -1) { #' +
                    '<div class="' +
                    '# if (data.value < 10) { #' +
                    "top1" +
                    '# } else if ( data.value < 20 ) { #' +
                    "top3" +
                    '# } else { #' +
                    "top4" +
                    '# } #' +
                    '">#= data.value #</div>' +
                    '# } else { #' +
                    '#= data.value #' +
                    '# } #'
            },
            footer: false
        });
        $('#calendar_max_calendar_div').kendoCalendar({
            value : today
        });
        $('#calendar_max_schedule_div').kendoScheduler({
            date : today,
            views: ["day", 'week', 'month'],
            eventTemplate: $("#slotTemplateForDayView").html(),
            currentTimeMarker: false,
            mobile: true,
            dataSource: [
                {
                    id: 1,
                    start: new Date("2014/7/15 03:00 AM"),
                    end: new Date("2014/7/15 04:00 AM"),
                    isAllDay: false,
                    title: "Interview"
                },
                {
                    id: 2,
                    start: new Date("2014/7/15 03:00 AM"),
                    end: new Date("2014/7/15 04:00 AM"),
                    isAllDay: false,
                    title: "2nd Interview"
                }
            ],
            width : 615,
            height : 615
        });
        $("#calendar_max_schedule_div").data("kendoScheduler").view("day");

    }
    function _zoomin_CB() {
        $('#calendar_panel').css({width : '768px'});
        $("#calender_panel_resize_icon").toggleClass("main_common_f_13_13 main_common_m_13_13");
        $('#calendar_min_panel').hide();
        $('#calendar_max_panel').show();
    }
    function _zoomout_CB () {
        $('#calendar_panel').css({width : '256px'});
        $("#calender_panel_resize_icon").toggleClass("main_common_f_13_13 main_common_m_13_13");
        $('#calendar_min_panel').show();
        $('#calendar_max_panel').hide();
    }
    return {
        init : _initCalendarPage,
        zoomin_callback : _zoomin_CB,
        zoomout_callback : _zoomout_CB,
        a : 'abc'
    };
};

var calendar_view_model = kendo.observable({

});
var calendar_controller = new ClassCalendarController();

$(function () {

    var width = $(window).width();
    var height = Screen.bodyHeight;
    $('#calendar_panel').css({
        width:"256",
        height:height
    });

    $('#calendar_panel').appendTo('#calendar');

    //scroll in homepage
    HomePage_Scrollable.registerZoomCallback(2, calendar_controller.zoomin_callback, calendar_controller.zoomout_callback);
    $('#calendar_panel_resize_icon').bind( {
        click : function (e) {
            HomePage_Scrollable.zoom(2);
        }
    });

    calendar_controller.init();

});

